package com.dinner.model;

import com.dinner.util.DinnerFactory;
import com.jaccount.util.IConsumerIdentification;

public class ConsumerLoginFacadeImpl implements ConsumerLoginFacade {

	@Override 
	public Consumer getUserForLogin(String consumerID, String password) {
		
		if(ourSystem.isValid(consumerID, password)){
			DinnerFactory factory = DinnerFactory.getFactory();
			Consumer consumer = factory.newConsumer();
			consumer.setConsumerID(consumerID);
			consumer.setPassword(password);
			return consumer;
		}
		return null;
		
	}
	
	private IConsumerIdentification ourSystem = null;

	/**
	 * @return the ourSystem
	 */
	public IConsumerIdentification getOurSystem() {
		return ourSystem;
	}

	/**
	 * @param ourSystem the ourSystem to set
	 */
	public void setOurSystem(IConsumerIdentification ourSystem) {
		this.ourSystem = ourSystem;
	}

}
